/**
 * @file test_rtc.c
 * @author liufeng (liufeng@injoinic.com)
 * @brief test bsp_rtc module
 * @version 0.1
 * @date 2024-11-05
 *
 * @copyright Copyright (c) 2024  injoinic
 *
 */

#include "bsp_rtc.h"
#include "main.h"
#include "stdio.h"

void rtc_test()
{
    LL_RTC_TimeTypeDef Time;
    LL_RTC_DateTypeDef Date;

    timestamp_to_rtc(1730787828, &Time, &Date);
    rtc_set(&Time, &Date);

    while (1) {
        rtc_get(&Time, &Date);
        printf("%02d/%02d/%02d\r\n", 2000 + Date.Year, Date.Month, Date.Day);
        printf("%02d:%02d:%02d\r\n", Time.Hours, Time.Minutes, Time.Seconds);

        uint32_t timestamp = rtc_to_timestamp();
        printf("UTC timestamp:%d \r\n\r\n", timestamp);
        LL_mDelay(1000);
    }
}
